/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package actioncombination.common.util;


import actioncombination.common.value.Value;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Random;

/**
 *
 * @author Administrador
 */
public class Util {

    public static int selectMax(Collection<Value> args) {
        ArrayList<Value> col= (ArrayList<Value>) args;
        float maxReward = -9999;
        int posMax;
        posMax = 0;
        for (int i = 0; i < args.size(); i++) {
            if (Float.valueOf(col.get(i).toString()) >= maxReward) {
                posMax = i;
                maxReward = Float.valueOf(col.get(i).toString());
            }
        }
        return posMax;
    }

    public static int selectRandom(Collection<Value> args) {
        Random rnd = new Random(java.util.UUID.randomUUID().hashCode());
        return rnd.nextInt(args.size());
    }
}
